# 作者: 家里蹲 吴越洋
# 2023年02月27日21时15分22秒
def read(dir):
    file=open(dir,mode='r',encoding='utf8')
    text=file.read()
    print(text)
    file.close()

file=open('lianxi',mode='w+',encoding='utf8')
file.write('人生苦短，我学python')
file.close()
read('lianxi')

file=open('lianxi',mode='w+',encoding='utf8')
file.write('人生苦短，我学')
file.close()
read('lianxi')

file=open('lianxi',mode='a+',encoding='utf8')
file.write('python')
file.close()
read('lianxi')

file=open('lianxi',mode='r+',encoding='utf8')
file.write('我学')
file.close()
read('lianxi')